<!DOCTYPE HTML>
<html style="min-width:inherit;">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<script>
window.onload= function(){
	var linkList=window.parent.document.getElementsByTagName("link");//获取父窗口link标签对象列表
	var head=document.getElementsByTagName("head").item(0);
	//外联样式
	for(var i=0;i<linkList.length;i++){
	var l=document.createElement("link");
		l.rel = 'stylesheet'
		l.type = 'text/css'; 
		l.href=linkList[i].href;
		head.appendChild(l);
	}
}
</script>
</head>

<body>

<style>
html,body{ min-width:515px; overflow:visible; background:#FFF;}
.tiwen_box{ width:415px; padding:0 50px;}
.seeReport{ padding:10px 20px;}
.seeReport .s_pinjialist li{ padding:0;}
.seeReport .fenshu{ color:#22c168; font-size:18px; position:absolute; right:0; bottom:10px;}
.seeReport .fenshu span{ font-size:60px; margin-right:2px;}
.seeReport .progressBar ,
.seeReport .progressBar .subBar{ height:5px; line-height:5px;}
.seeReport .r_tip{ border-right:1px solid #e4e4e4;}
</style>
<div class="seeReport">
	<div class="line-bottom LH40 fs20">2017年会计电算化真题冲刺试卷20</div>
    <div class="line-bottom LH25 fs14 p-tb20 ir">
    	<p>科目：会计电算化</p>
    	<p>总分：100分</p>
    	<p>总题数：45道</p>
        <div class="fenshu"><span>0</span>分</div>
    </div>
    <div class="s_pinjialist p-tb20">
    <ul>
        <li class="item">
            <div class="tit l"><span>单选题</span></div>
            <div class="progressBar m-t15 l">
                <div class="subBar" style="width:10%"></div>
            </div>
            <div class="r_tip l">1/10</div>
        </li>
        <li class="item">
            <div class="tit l"><span>多选题</span></div>
            <div class="progressBar m-t15 l">
                <div class="subBar" style="background-color:#3CF; width:10%"></div>
            </div>
            <div class="r_tip l">1/10</div>
        </li>
        <li class="item">
            <div class="tit l"><span>判断题</span></div>
            <div class="progressBar m-t15 l">
                <div class="subBar" style="background-color:#F00; width:10%"></div>
            </div>
            <div class="r_tip l">1/10</div>
        </li>
        <li class="item">
            <div class="tit l"><span>实物操作题</span></div>
            <div class="progressBar m-t15 l">
                <div class="subBar" style="background-color:#F0F; width:20%"></div>
            </div>
            <div class="r_tip l">2/15</div>
        </li>
    </ul>
    </div>
    <div class="tar">
    <canvas id="i_loading" width="90" height="90" ></canvas>  
    </div>
	<script src="../skin/js/jquery-1.11.1.min.js" type="text/javascript"></script>
	<script type="text/javascript">
        /*加载圆*/
        function circleProgress(value,average){
            var canvas = document.getElementById("i_loading");
            var context = canvas.getContext('2d');
            var _this = $(canvas),
            value= Number(value),// 当前百分比,数值
            average = Number(average),// 平均百分比
            color = "",// 进度条、文字样式
            maxpercent = 100,//最大百分比，可设置
            c_width = _this.width(),// canvas，宽度
            c_height =_this.height();// canvas,高度
            // 判断设置当前显示颜色
            if( value== maxpercent ){
                color="#37c393";
            }else if( value> average ){
                color="#37c393";
            }else{
                color="#37c393";
            }
            // 清空画布
            context.clearRect(0, 0, c_width, c_height);
            // 画初始圆
            context.beginPath();
            // 将起始点移到canvas中心
            context.moveTo(c_width/2, c_height/2);
            // 绘制一个中心点为（c_width/2, c_height/2），半径为c_height/2，起始点0，终止点为Math.PI * 2的 整圆
            context.arc(c_width/2, c_height/2, c_height/2, 0, Math.PI * 2, false);
            context.closePath();
            context.fillStyle = '#eeeeee'; //填充颜色
            context.fill();
            // 绘制内圆
            context.beginPath();
            context.strokeStyle = color;
            context.lineCap = 'square';
            context.closePath();
            context.fill();
            context.lineWidth = 4.0;//绘制内圆的线宽度
        
            function draw(cur){
                // 画内部空白  
                context.beginPath();  
                context.moveTo(0, 0);  
                context.arc(c_width/2, c_height/2, c_height/2, 0, Math.PI * 2, true);  
                context.closePath();  
                context.fillStyle = 'rgba(255,255,255,1)';  // 填充内部颜色
                context.fill();
                // 画内圆
                context.beginPath();
                // 绘制一个中心点为（c_width/2, c_height/2），半径为c_height/2-5不与外圆重叠，
                // 起始点-(Math.PI/2)，终止点为((Math.PI*2)*cur)-Math.PI/2的 整圆cur为每一次绘制的距离
                context.arc(c_width/2, c_height/2, c_height/2-2, -(Math.PI / 2), ((Math.PI * 2) * cur ) - Math.PI / 2, false);
                context.stroke();
                //在中间写字  
                context.font = "14px Arial";  // 字体大小，样式
                context.fillStyle = "#444444";  // 颜色
                context.textAlign = 'center';  // 位置
                context.textBaseline = 'middle';  
                context.moveTo(c_width/2, c_height/2);  // 文字填充位置
                context.fillText(value+"%", c_width/2, c_height/2-10);
                context.fillText("正确率", c_width/2, c_height/2+10);
            }
            // 调用定时器实现动态效果
            var timer=null,n=0;
            function loadCanvas(nowT){
                timer = setInterval(function(){
                    if(n>nowT){
                        clearInterval(timer);
                    }else{
                        draw(n);
                        n += 0.01;
                    }
                },15);
            }
            loadCanvas(value/100);
            timer=null;
        };
        $(function(){
            circleProgress(20,100);	
        });
    </script>
</div>
</body>
</html>
